<?php

	$title = getTerm('albums', 'share_photos_worldwide');
	pushNavigationItem( getTerm('albums', 'albums') , formatUrl('/albums/') );
	printNoBorderHeader( $title , $title , 'albums' );
	
?>
	<div style="float:left;">
		<img src="/Images/image<?= 1+rand()%4 ?>.jpg" width="400" />
	</div>
	
	<div id="albumRoot" style="float:left;margin-left:15px;">
		
		<p style="padding-top: 30px;">
		
			<?= getTerm('albums', 'photo_sharing_hint') ?>
			
		</p>
		
		<?php if ( $currentUser==-1 ) { ?>
			
		<p class="important">
			<a href="/signin"><?= getTerm('albums', 'sign_up_and_begin') ?></a>
		</p>
			
		<?php } elseif ( count(getUserAlbums($currentUser['id']))>0 ) { ?>
		
		<p class="important">
			<a href="<?= formatUrl("/albums/${currentUser[username]}/") ?>"><?= getTerm('albums', 'manage_your_photos') ?></a>
		</p>
		
		<?php } else { ?>
			
		<p>
			<form action="<?= $_SERVER['REQUEST_URI'] ?>" method="post" enctype="multipart/form-data">
			
				<h3><?= getTerm('albums', 'share_your_first') ?></h3>
			
				<input type="hidden" name="ac" value="uploadphoto" />
				
			<?php if ( ! empty($photoError) ) { ?>
					<div class="field error">
					<label for="photo"><?= getTerm('albums', 'photo_path') ?></label>
					<div class="error-hint"><?= $photoError ?></div>
			<?php } else { ?>
					<div class="field">
					<label for="photo"><?= getTerm('albums', 'photo_path') ?></label>
			<?php } ?>
					<input type="file" id="photo" name="photo" value="<?= $albumNameValue ?>" />
				</div>
				
				<input type="submit" value="<?= getTerm('albums', 'share_photo') ?>" />
				
			</form>
		</p>
			
		<?php } ?>
		
		<p>
		
			<h3><?= getTerm('albums', 'search_photos') ?></h3>
			
			<form action="<?= formatUrl('/albums/search.do') ?>" method="get">
			
				<input type="text" name="w" id="keywords" />
				
				<input type="hidden" name="p" value="1" />
				
				<input type="submit" value="<?= getTerm('albums', 'search') ?>" />
			
			</form>
		
		</p>
		
		<div id="otherPhotosOverview">
		<p>
		
			<h3><?= getTerm('albums', 'latest') ?></h3>
			<ul id="userList">
			<?php foreach ($latestPhotos as $photo) { ?>
				
				<li id="photo-<?= $photo['id'] ?>">
					<a href="<?= formatUrl("/albums/${photo[username]}/${photo[albumPath]}/${photo[path]}.html") ?>"<?php echo 'class="'.$photo['gender'].'"'; ?>>
						<img src="/Thumbs/<?= $photo['id'] ?>-square.jpg" width="100" height="100" title="<?= $photo['name'] ?>" />
						<div class="uinfo nobreak"><?php echo $photo['username'].',&nbsp;'.$photo['age'];?></div>
						<div class="uloc"><?php echo getTerm('country', $photo['country']); ?></div>
					</a>
				</li>
				
			<?php } ?>
			</ul>
		
		</p>
		</div>
		
	</div>

<?php

	printFooter();

?>